#!/bin/bash

echo "请选择要编译的系统环境："
echo ""
echo "1. Windows_amd64"
echo "2. linux_amd64"

read -p "请选择：" action

if [ "$action" == 1 ]; then
    echo "编译Windows版本64位"
    export CGO_ENABLED=0
    export GOOS=windows
    export GOARCH=amd64

    go build -o usercenter/target/project-user.exe usercenter/main.go
    go build -o project-api/target/project-api.exe project-api/main.go

elif [ "$action" == 2 ]; then
    echo "编译Linux版本64位"

    export CGO_ENABLED=0
    export GOOS=linux
    export GOARCH=amd64

   go build -o /Users/x/GolandProjects/ms_project/project-api/target/project_api project-api/main.go
   go build -o /Users/x/GolandProjects/ms_project/project-user/target/project_user project-user/main.go

else
   echo "无效选择，请重新运行脚本并输入有效选项。"
fi
